Cytosim  PI
Cytoskeleton Simulator
InputWrapper Class Reference

Detailed Description

Todo:
: Introduce a set of classes: Inputter (text, base class) InputterText InputterBinary InputterBinarySwap

Instead of setBinarySwap), you would use the appropriate class.

Outputter OutputterText

Inheritance diagram for InputWrapper:
FileWrapper

Public Member Functions

void iwConstructor ()
 set defaults (not-binary)
 
 InputWrapper ()
 Constructor.
 
 InputWrapper (FILE *f, const char *path=0)
 Constructor.
 
 InputWrapper (const char *name, bool bin)
 constructor which opens a file
 
virtual ~InputWrapper ()
 Destructor which closes the input and output files.
 
void inputDIM (const int d)
 Sets dimentionnality of vectors.
 
int formatID () const
 returns the type of input
 
void formatID (const int f)
 returns the type of input
 
int binary () const
 Returns 1 for native binary format, 2 for non-native binary format, and 0 if not binary.
 
void setBinarySwap (const char[2])
 Automatically find in which way bytes are stored in the binary format. More...
 
int8_t readInt8 ()
 Read integer on 1 byte.
 
int16_t readInt16 ()
 Read integer on 2 bytes.
 
int32_t readInt32 ()
 Read integer on 4 bytes.
 
uint8_t readUInt8 ()
 Read unsigned integer on 1 byte.
 
uint16_t readUInt16 ()
 Read unsigned integer on 2 bytes.
 
uint32_t readUInt32 ()
 Read unsigned integer on 4 bytes.
 
float readFloat ()
 Reads a float on 4 bytes.
 
double readDouble ()
 Reads a float on 8 bytes.
 
void readFloatVector (float *, unsigned D)
 Reads a vector, and store in the array of size D.
 
void readFloatVector (double *, unsigned D)
 Reads a vector, and store in the array of size D.
 
void readFloatVector (float *, unsigned n, unsigned D)
 Reads a vector, and store in the array of size D.
 
void readFloatVector (double *, unsigned n, unsigned D)
 Reads a vector, and store in the array of size D.
 
- Public Member Functions inherited from FileWrapper
 FileWrapper ()
 constructor - no file
 
 FileWrapper (FILE *, const char *path=0)
 constructor which opens a file
 
 FileWrapper (const char *name, const char *mode)
 constructor which opens a file
 
virtual ~FileWrapper ()
 destructor
 
void operator= (FILE *)
 constructor from an already opened file
 
 operator FILE * ()
 automatic conversion to a FILE *
 
int open (const char *name, const char *mode)
 open a file More...
 
void rewind ()
 rewind file
 
void clearerr ()
 rewind file
 
void close ()
 close file
 
FILE * file ()
 return the file pointer
 
const char * path () const
 the path of the file, or of the last attempt to open a file
 
bool std () const
 true if output goes to stdout
 
bool eof () const
 true if End-Of-File
 
int error () const
 return the value of ferror()
 
bool good () const
 true if file is good for writing / reading
 
int get_pos (fpos_t &p) const
 current position in input file, relative to beggining
 
void set_pos (const fpos_t &p)
 set position relative to the beginning of the file
 
void put_line (const char *line, char sep=0)
 put string More...
 
void put_line (const std::string &line, char sep=0)
 put string
 
void get_line (std::string &line, char sep='\n')
 read line, including the terminating '
'; return the position where the line started More...
 
void skip_until (const char *str)
 read stream until given string is found More...
 
void lock ()
 lock file by the current thread
 
void unlock ()
 unlock file
 
int getUL ()
 read a character
 
int peek ()
 report next character to be read
 
void unget (int c)
 report next character to be read
 
int write (const char c)
 write a character
 
void flush ()
 flush
 

Additional Inherited Members

- Protected Attributes inherited from FileWrapper
FILE * mFile
 the C-file descriptor
 
std::string mPath
 the name of the file or some other information:
 

Member Function Documentation

void setBinarySwap ( const char  import[2])

Reads a short and compares with the native storage, to set inBinary=1, for same-endian or inBinary = 2, for opposite endian